<?php
$id = $_REQUEST['id'];
$con = mysql_connect("localhost","root","root");
$ret = mysql_select_db("keyvaldb", $con);

$result = mysql_query("SELECT `IMG` FROM `img` WHERE `ID` = $id");
if( $row = @mysql_fetch_array($result) )
{
	$data = $row[0];
	header("Content-type: image/png");
	echo $data;	
}
mysql_close($con);
?>